package com.sgb.goods.view.adapter;

import android.text.TextUtils;

import androidx.databinding.ViewDataBinding;

import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.databinding.GoodsItemChoiceVipPriceGoodsBinding;
import com.sgb.goods.entity.VipPriceMangeListEntity;
import com.sgb.goods.utils.base.adapter.RecordPointCommonAdapter;

/**
 * 选择会员价商品适配器
 * @author cyj
 */
public class ChoiceVipPriceGoodsAdapter extends RecordPointCommonAdapter<VipPriceMangeListEntity> {

    public ChoiceVipPriceGoodsAdapter() {
        super(R.layout.goods_item_choice_vip_price_goods, BR.viewModel);
    }

    @Override
    protected void convert(BaseViewHolder baseHolder, ViewDataBinding dataBinding, VipPriceMangeListEntity entity) {
        GoodsItemChoiceVipPriceGoodsBinding mDataBinding = (GoodsItemChoiceVipPriceGoodsBinding) dataBinding;

        String pinpai = entity.brandName;
        if (!TextUtils.isEmpty(entity.brandName) && !TextUtils.isEmpty(entity.preciseStorageName)) {
            pinpai = entity.brandName + " | " + entity.preciseStorageName;
        } else if (!TextUtils.isEmpty(entity.preciseStorageName)) {
            pinpai = entity.preciseStorageName;
        }
        mDataBinding.tvPinpai.setText(!TextUtils.isEmpty(pinpai) ? pinpai : "/");
    }

    @Override
    public boolean equivalentToObject(VipPriceMangeListEntity object1, VipPriceMangeListEntity object2) {
        return false;
    }
}
